from typing import *


class Solution:

    def minNumber(self, nums1: List[int], nums2: List[int]) -> int:
        a = sorted(map(int, nums1))
        b = sorted(map(int, nums2))
        s = set(a)
        for x in b:
            if x in s:
                return x
        p = min(a[0], b[0])
        q = max(a[0], b[0])
        return p * 10 + q


s = Solution()
print(s.minNumber(nums1=[4, 1, 3], nums2=[5, 7]))


if (x:=10)==10:
    print(x)